<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<mesoBoard.Web.Models.ViewThread>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <div class="bread_crumb left">
        <%= Html.ActionLink("Board Index", "Index", "Board")%>
        &raquo;
        <%= Html.ActionLink(Model.Thread.Forum.Name, "ViewForum", "Board", new { ForumID = Model.Thread.Forum.ForumID }, null) %>
        &raquo;
        <%= Html.ActionLink(Model.Thread.Title, "ViewThread", "Board", new { ThreadID = Model.Thread.ThreadID }, new { style = "font-weight:bold" })%>
    </div>
    
    <div style="clear: both">
        <div class="left">
            <%= Html.CreatePostLink(Model.Thread) %>
            <%= Html.SubscriptionLink(Model.Thread.ThreadID, Model.IsSubscribed) %>
        </div>

        <div class="right">
            <% if(Model.Paging.TotalPages != 1) Html.RenderPartial("Paging", Model.Paging); %>
        </div>
    </div>
    
    <%= Html.Spacer(3) %>
    
    <div class="thread_body">
        <div class="thread_details">
        Title: <%= !string.IsNullOrEmpty(Model.Thread.Image) ? Html.Image("~/Images/ThreadImages/" + Model.Thread.Image, new { @class = "middle_align" }).ToString() : ""%> <%= Model.Thread.FirstPost.Title%>
            <div class="right" style="width: auto; font-weight: normal; font-size: 11px">
                <% Html.RenderPartial("ThreadActions", Model.ThreadActions); %>
            </div>
        </div>
         
        <% if (Model.Thread.HasPoll) { %>
        <%     // Display Poll                 
               Html.RenderPartial("ThreadPoll",
                      new mesoBoard.Web.Models.ThreadPoll
                      {
                          CanCastVote = Model.CanCastVote && !Model.HasVoted && !Model.Thread.IsLocked,
                          CurrentUser =  Model.CurrentUser,
                          ThePoll = Model.Thread.Poll
                      }); %>
        <%   } %>
        
        <% foreach (var postRow in Model.Posts)
           {
               // Display Posts
               Html.RenderPartial("PostRow", postRow);
           } %>
               
    </div>

    <div>
        <div class="left">
            <%= Html.CreatePostLink(Model.Thread) %>
            
            <%= Html.SubscriptionLink(Model.Thread.ThreadID, Model.IsSubscribed)%>
        </div>

        <div class="right">
            <% if(Model.Paging.TotalPages != 1) Html.RenderPartial("Paging", Model.Paging); %>
        </div>
    </div>

    <div class="bread_crumb left">
        <%= Html.ActionLink("Board Index", "Index", "Board")%>
        &raquo;
        <%= Html.ActionLink(Model.Thread.Forum.Name, "ViewForum", "Board", new { ForumID = Model.Thread.Forum.ForumID }, null) %>
        &raquo;
        <%= Html.ActionLink(Model.Thread.Title, "ViewThread", "Board", new { ThreadID = Model.Thread.ThreadID }, new { style = "font-weight:bold" })%>
    </div>


    <%= Html.Spacer(1) %>
        
    <% if(User.Identity.IsAuthenticated && !Model.Thread.IsLocked){
           Html.RenderPartial("QuickReply", Model.Thread);
    } %>
</asp:Content>
